import java.util.*;

/**
 * @author 03010570
 * @date 2020/07/08
 * describe:    LeetCode : 面试题 16.11 https://leetcode-cn.com/problems/diving-board-lcci/
 */
public class LeetCode_interview_16_11 {

    public static void main(String[] args) {
        LeetCode_interview_16_11 interview1611 = new LeetCode_interview_16_11();
        int[] ints = interview1611.divingBoard(1, 2, 3);
        for (int anInt : ints) {
            System.out.println(anInt);
        }

    }

    /**
     *  一定有 k+1 个数
     *  假设有
     * @param shorter
     * @param longer
     * @param k
     * @return
     */
    public int[] divingBoard(int shorter, int longer, int k) {
        if(k==0){
            return new int[0];
        }else if(shorter == longer){
            return new int[]{k * shorter};
        }
        int[] ints = new int[k + 1];
        for(int i =0;i <=k ;i++){
            ints[i]= shorter * (k-i) + longer *i;
        }
        return ints;
    }

}
